<template>
	<b-layout-index>
		<navbar bgcolor="#fff" :title="$t('代理中心')"></navbar>
		<view class="pd-left-10 pd-right-10">
			<base-panel-title :isRadius="true" :fill="true">
				<u-cell-group :border="false">
					<u-cell  :border="false" :url="'./list?userId='+userId+'&id=0&name='+$t('直属代理')"   icon="account-fill" :title="$t('直属代理')" isLink>
						<view slot="value">{{count}}个</view>
					</u-cell>
				</u-cell-group>
			</base-panel-title>
		</view>
		<view class="pd-left-10 pd-right-10">
			<base-panel-title :isRadius="true" :fill="true">
				<u-cell-group :border="false">
					<u-cell   :border="false" :url="'./list?userId='+userId+'&id='+itema.id+'&name='+itema.name" v-for="(itema,indexa) in datalist" icon="account-fill" :title="itema.name" isLink>
						<view slot="value">{{itema.count}}个</view>
					</u-cell>
				</u-cell-group>
			</base-panel-title>
		</view>
	</b-layout-index>
</template>

<script>
	import {
		getFindByMiniList
	} from "@/api/agent.js"
	export default {
		data() {
			return {
				datacard: [{
					title: this.$t("直属代理"),
					value: 2
				}],
				count:0,
				datalist: [],
				userId:0
			}
		},
		onLoad: function(options) {
			console.log(options)
						this.userId = options.userId ? options.userId : 0
			this.getFindByList()

		},
		methods: {
			getFindByList: function() {
				var the = this;
				getFindByMiniList(the.userId).then(res => {
					the.datalist = res.list;
					the.count=res.count
				})
			}
		}
	}
</script>

<style>
</style>
